﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public class GridColumn
    {
        public string Name { get; set; }
        public string Caption { get; set; }
        public string DataItemId { get; set; }

        public List<GridColumnConditionImage> ImagePrefixs { get; set; }

        public List<GridColumnConditionImage> ImageSuffixs { get; set; }

        public string HAlignment { get; set; }
        public string VAlignment { get; set; }

        public double? Width { get; set; }

        public string TextFormat { get; set; }
        /// <summary>
        /// value的类型string,double,int,float,datetime等
        /// double: {0:d2}%,{0:d2}
        /// </summary>
        public string ValueType { get; set; }

        /// <summary>
        /// 列的内部间距
        /// </summary>
        public Thickness Padding { get; set; }

        public List<GridColumn> Columns { get; set; }
    }

    public class GridColumnConditionImage : System.ComponentModel.INotifyPropertyChanged
    {
        private ImageSourceFile _ImageSource;
        public ImageSourceFile ImageSource
        {
            get { return _ImageSource; }
            set
            {
                _ImageSource = value;
                NotifyPropertyChanged();
            }
        }
        public string Condition { get; set; }

        /// <summary>
        /// 内部嵌入的组件元数据
        /// </summary>
        public string TemplateName { get; set; }

        public event PropertyChangedEventHandler PropertyChanged;

        public void NotifyPropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = "")
        {
            if(PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
